package free.akerigan.yafb2lib.model;

import java.util.ArrayList;

public class BookModel{

    protected String title;
    protected String annotation;
    protected String genre;
    protected String date;
    
    ArrayList<String> authors = null;
    
    public String getTitle() {
	return title;
    }

    public void setTitle(String title) {
	this.title = title;
    }

    public String getAnnotation() {
	return annotation;
    }

    public void setAnnotation(String annotation) {
	this.annotation = annotation;
    }

    public String getGenre() {
	return genre;
    }

    public void setGenre(String genre) {
	this.genre = genre;
    }

    public String getDate() {
	return date;
    }

    public void setDate(String date) {
	this.date = date;
    }
    
    public void addAuthor(String authorId) {
	if (authors == null) {
	    authors = new ArrayList<String>();
	}
	authors.add(authorId);
    }
    
    public int getAuthorsCount() {
	if (authors == null) {
	    return 0;
	} else {
	    return authors.size();
	}
    }
    
    public String getAuthorId(int index) {
	if (authors == null || index < 0 || index > authors.size()-1) {
	    return null;
	} else {
	    return authors.get(index);
	}
    }
    
}
